package FinalHomework;

import AdapterPattern.Client;
import AdapterPattern.ObjectClient;
import Composite.ComponentPatternMain;
import FactoryMode.AbstractFactoryClient;
import FactoryMode.FactoryModeClient;
import FactoryMode.SimpleFactoryClient;
import InterfaceProgramming.InterfaceProgrammingClient;
import MultipleFactoryMode.MultipleFactoryModeClient;
import SingleFactoryMode.SingleFactoryModeClient;
import TransparentCombination.ComponentPatternClient;
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;
import javafx.scene.text.Text;
import javafx.stage.Stage;

public class UI<Target> extends Application{

	@Override
	public void start(Stage primaryStage) throws Exception {
		// TODO Auto-generated method stub
		FlowPane pane = new FlowPane();
		VBox paneLeft = new VBox(10);
		VBox paneRight = new VBox(5);
		paneLeft.setPadding(new Insets(10, 10, 10, 10));
		Image image = new Image(getClass().getResourceAsStream("yyx.jpg"), 450, 300, false, false);
		ImageView imageView = new ImageView(image);
		Text text1 = new Text("姓名：杨宜鑫");
		text1.setFont(Font.font("Verdana", FontWeight.BOLD, 20));
		Text text2 = new Text("学号：201627020125");
		text2.setFont(Font.font("Verdana", FontWeight.BOLD, 20));
		paneLeft.getChildren().addAll(imageView, text1, text2);

		paneRight.setPadding(new Insets(20, 10, 10, 20));
		Button button1 =new Button("实验一：单例模式");
		button1.setPadding(new Insets(5, 10, 5, 10));
		button1.setOnMouseClicked(e->{
			Stage stage1 = new Stage();
			SingleFactoryModeClient singleFactoryModeClient = new SingleFactoryModeClient();
			Scene scene1 = singleFactoryModeClient.getStage();
			stage1.setScene(scene1);
			stage1.setTitle("实验一：单例模式");
			stage1.show();
		});

		Button button2 =new Button("实验一：多例模式");
		button2.setPadding(new Insets(5, 10, 5, 10));
		button2.setOnMouseClicked(e->{
			Stage stage2 = new Stage();
			MultipleFactoryModeClient multipleFactoryModeClient = new MultipleFactoryModeClient();
			Scene scene2 = multipleFactoryModeClient.getStage();
			stage2.setTitle("实验一：多例模式");
			stage2.setScene(scene2);
			stage2.show();
		});

		Button button3 =new Button("实验一：接口编程");
		button3.setPadding(new Insets(5, 10, 5, 10));
		button3.setOnMouseClicked(e->{
			Stage stage3 = new Stage();
			InterfaceProgrammingClient interfaceProgrammingClient = new InterfaceProgrammingClient();
			Scene scene3 = interfaceProgrammingClient.getStage();
			stage3.setTitle("实验一：接口编程");
			stage3.setScene(scene3);
			stage3.show();
		});

		Button button4 =new Button("实验二：简单工厂");
		button4.setPadding(new Insets(5, 10, 5, 10));
		button4.setOnMouseClicked(e->{
			Stage stage4 = new Stage();
			SimpleFactoryClient simpleFactoryClient = new SimpleFactoryClient();
			Scene scene4 = simpleFactoryClient.getStage();
			stage4.setTitle("实验二：简单工厂");
			stage4.setScene(scene4);
			stage4.show();
		});

		Button button5 =new Button("实验二：工厂模式");
		button5.setPadding(new Insets(5, 10, 5, 10));
		button5.setOnMouseClicked(e->{
			Stage stage5 = new Stage();
			FactoryModeClient factoryModeClient = new FactoryModeClient();
			Scene scene5 = factoryModeClient.getStage();
			stage5.setTitle("实验二：工厂模式");
			stage5.setScene(scene5);
			stage5.show();
		});

		Button button6 =new Button("实验二：抽象工厂");
		button6.setPadding(new Insets(5, 10, 5, 10));
		button6.setOnMouseClicked(e->{
			Stage stage6 = new Stage();
			AbstractFactoryClient abstractFactoryClient = new AbstractFactoryClient();
			Scene scene6 = abstractFactoryClient.getStage();
			stage6.setTitle("实验二：抽象工厂");
			stage6.setScene(scene6);
			stage6.show();
		});

		Button button7 =new Button("实验三：适配器（对象）");
		button7.setPadding(new Insets(5, 10, 5, 10));
		button7.setOnMouseClicked(e->{
			Stage stage7 = new Stage();
			ObjectClient obclient = new ObjectClient();
			Scene scene7 = obclient.getStage();
			stage7.setScene(scene7);
			stage7.show();
		});

		Button button8 =new Button("实验三：适配器（类）");
		button8.setPadding(new Insets(5, 10, 5, 10));
		button8.setOnMouseClicked(e->{
			Stage stage8 = new Stage();
			Client client = new Client();
			Scene scene8 = client.getStage();
			stage8.setScene(scene8);
			stage8.show();
		});

		Button button9 =new Button("实验四：安全组合模式");
		button9.setPadding(new Insets(5, 10, 5, 10));
		button9.setOnMouseClicked(e->{
			Stage stage9 = new Stage();
			ComponentPatternMain componentPatternMain = new ComponentPatternMain();
			Scene scene9 = componentPatternMain.getStage();
			stage9.setScene(scene9);
			stage9.show();
		});

		Button button10 =new Button("实验四：一致性组合模式");
		button10.setPadding(new Insets(5, 10, 5, 10));
		button10.setOnMouseClicked(e->{
			Stage stage10 = new Stage();
			ComponentPatternClient componentPatternClient = new ComponentPatternClient();
			Scene scene10 = componentPatternClient.getStage();
			stage10.setScene(scene10);
			stage10.show();
		});

		paneRight.getChildren().addAll(button1, button2, button3, button4, button5, button6, button7, button8, button9, button10);
		pane.getChildren().addAll(paneLeft, paneRight);

		Scene scene =new Scene(pane, 700, 400);
		primaryStage.setTitle("综合性实验");
		primaryStage.setScene(scene);
		primaryStage.show();
	}

	public static void main(String[] args) {
		launch(args);
	}

}
